<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  class Cat {
    constructor(name, color) {
      this.name = name;
      this.color = color;
    }
    call() {
      console.log("喵喵");
    }
  }


  class Dog {
    constructor(name, color) {
      this.name = name;
      this.color = color;
    }
    call() {
      console.log("旺旺");
    }
  }

  class Pig {
    constructor(name, color) {
      this.name = name;
      this.color = color;
    }
    call() {
      console.log("哼哼");
    }
  }

  var kitty = new Cat("Kitty", "pink");
  var wang = new Dog("旺财", "black");
  var pei = new Pig("佩奇", "pink");

  // console.log(kitty);

  function AnimallCall(animal) {
    animal.call();
  }


  AnimallCall(kitty);
  AnimallCall(wang);
  AnimallCall(pei);
</script>

</html>